package com.mashibing.juc.c_027_future_to_loom;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @author: Yuanzt
 * @Date: 2021/4/6
 */
public class T01_Future {

    public static void main(String[] args) {
        ExecutorService service = Executors.newCachedThreadPool();
        Future<Integer> future = service.submit(()->8);
        int i = 0;
        try {
            i = future.get();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
        System.out.println(i);
    }

}
